import React, { Component } from "react";
import qs from "qs";

export default class Detail extends Component {
  render() {
    // 接收search参数
    const { search } = this.props.location;
    // key=value&key1=value1是urlencoded编码字符串，需要借助qs解析
    const { id, title } = qs.parse(search.slice(1));
    return (
      <div>
        <ul>
          <li>{id}</li>
          <li>{title}</li>
        </ul>
      </div>
    );
  }
}
